//
//  NSButton+TextColor.m
//  MacWeb
//
//  Created by 小贝 on 16/3/21.
//  Copyright © 2016年 Boye. All rights reserved.
//

#import "NSButton+TextColor.h"

@implementation NSButton (TextColor)
+ (void)setTextColor:(NSButton *)btn andColor:(NSColor *) textColor{
    NSMutableAttributedString *attrTitle = [[NSMutableAttributedString alloc]
                                            initWithAttributedString:[btn attributedTitle]];
    NSUInteger len = [attrTitle length];
    NSRange range = NSMakeRange(0, len);
    [attrTitle addAttribute:NSForegroundColorAttributeName
                      value:textColor
                      range:range];
    [attrTitle fixAttributesInRange:range];
    [btn setAttributedTitle:attrTitle];

}
@end
